<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script language="JavaScript" src="/js/vue.min.js"></script>
    <script language="JavaScript" src="/js/axios.min.js"></script>


</head>
<body>
<div id="UserDiv">
    <table border="1">
        <tr>
            <td>用户</td>
            <td>图书</td>
            <td>地址</td>
            <td>手机号</td>
            <td>备注</td>
        </tr>
        <tr v-for="order in orderInforList">
            <td>{{order.uid}}</td>
            <td>{{order.bid}}</td>
            <td>{{order.address}}</td>
            <td>{{order.phone}}</td>
            <td>{{order.remark}}</td>
        </tr>
    </table>
<!--    查询用户信息以及用户的订单列表-->

</div>
<script language="JavaScript">
    var vm = new Vue({
        el: "#UserDiv",
        data: {
            orderInforList: [],
            uid:""
        },
        created() {
            this.oneValues();
            this.findorderInforList();
        },
        methods: {
            findorderInforList: function () {
                var path = "http://localhost:8070/order/finduid"
                var param = {params:{"uid":this.uid}};
                axios.get(path,param).then(function (obj) {
                    if (obj.status == 200) {
                        var pathResult = obj.data;
                        vm.orderInforList = pathResult.obj;
                        alert(vm.orderInforList)
                        return;
                    }
                }).catch(function (error) {
                    alert("订单有异常了")
                })
            },
            //接收其他页面的一个值
            oneValues:function () {
                var userid;
                var url=window.location.search;
                if(url.indexOf("?")!=-1){
                    userid = url.substr(url.indexOf("=")+1);
                    this.uid = userid;
                }
                return;
            }
        }
    });

</script>
</body>
</html>